package goodbaby.dklt;

import android.content.SharedPreferences;

import com.classic.core.utils.StringUtil;

/**
 * Created by Jayden on 2016/4/25 17:12.
 *
 * @version V1.0
 * @Title: GbbPreferences
 * @Description: ${todo}
 */
public class GbbPreferences {
    private static final String KEY_BRACELETADDRESS = "braceletAddress";
    private static final String KEY_CHILDRENNAME = "childrenName";
    private static final String KEY_CLASSID = "classId";
    private static final String KEY_CLASSNAME = "className";
    private static final String KEY_HEADIMG = "headImg";
    private static final String KEY_IS_FIRST = "isFirst";
    private static final String KEY_KEEP_LOGIN = "keepLogin";
    private static final String KEY_NICKNAME = "nickName";
    private static final String KEY_SCHOOLNAME = "schoolName";
    private static final String KEY_SOBJECT = "sObject";
    private static final String KEY_USERID = "userId";
    private static final String KEY_USER_ACCOUNT = "account";
    private static final String KEY_USER_PWD = "password";
    private static final String KEY_ROLE = "role";
    private static final String KEY_NAME = "name";
    private static final String KEY_CLASSTEACHERID = "classTeacherId";
    private static final String KEY_HEIGHT = "height";
    private static final String KEY_ADMINID = "adminId";
    private static final String KEY_BIRTHDAY = "birthday";
    private static final String KEY_WEIGHT = "weight";
    private static final String KEY_SEX = "sex";
    private static final String KEY_VERSION = "version";
    private static final String KEY_VERSION_DSP = "versionDescription";
    private static final String KEY_VERSION_URL = "versionUrl";
    private static final String KEY_DEEP_SLEEP = "deepSleep";
    private static final String KEY_LIGHT_SLEEP = "lightSleep";
    private static final String KEY_START_TIME = "startTime";
    private static final String KEY_END_TIME = "endTime";


    public static void saveSex(String sex) {
        saveString(KEY_SEX, sex);
    }

    public static String getSex() {
        return getString(KEY_SEX);
    }

    public static void saveWeight(String weight) {
        saveString(KEY_WEIGHT, weight);
    }

    public static String getWeight() {
        return getString(KEY_WEIGHT);
    }

    public static void saveBirthday(String birthday) {
        saveString(KEY_BIRTHDAY, birthday);
    }

    public static String getBirthday() {
        return getString(KEY_BIRTHDAY);
    }

    public static void saveAdminId(String adminId) {
        saveString(KEY_ADMINID, adminId);
    }

    public static String getAdminId() {
        return getString(KEY_ADMINID);
    }

    public static void saveHeight(String height) {
        saveString(KEY_HEIGHT, height);
    }

    public static String getHeight() {
        return getString(KEY_HEIGHT);
    }

    public static void saveClassTeacherId(String classTeacherId) {
        saveString(KEY_CLASSTEACHERID, classTeacherId);
    }

    public static String getClassTeacherId() {
        return getString(KEY_CLASSTEACHERID);
    }

    public static void saveName(String name) {
        saveString(KEY_NAME, name);
    }

    public static String getName() {
        return getString(KEY_NAME);
    }

    public static String getBraceletAddress() {
        return getString(KEY_BRACELETADDRESS);
    }

    public static String getChildrenName() {
        return getString(KEY_CHILDRENNAME);
    }

    public static String getClassId() {
        return getString(KEY_CLASSID);
    }

    public static String getClassName() {
        return getString(KEY_CLASSNAME);
    }

    public static String getHeadImg() {
        return getString(KEY_HEADIMG);
    }

    public static String getIsFirst() {
        return getString(KEY_IS_FIRST);
    }

    public static String getKeepLogin() {
        return getString(KEY_KEEP_LOGIN);
    }

    public static String getNickName() {
        return getString(KEY_NICKNAME);
    }

    public static String getSObject() {
        return getString(KEY_SOBJECT);
    }

    public static String getSchoolName() {
        return getString(KEY_SCHOOLNAME);
    }

    public static String getUserAccount() {
        return getString(KEY_USER_ACCOUNT);
    }

    public static String getUserId() {
        return getString(KEY_USERID);
    }

    public static String getUserPwd() {
        return getString(KEY_USER_PWD);
    }

    public static String getRole() {
        return getString(KEY_ROLE);
    }

    public static String getDeepSleep() {
        return getString(KEY_DEEP_SLEEP);
    }

    public static String getLightSleep() {
        return getString(KEY_LIGHT_SLEEP);
    }

    public static String getStartTime() {
        return getString(KEY_START_TIME);
    }

    public static String getEndTime() {
        return getString(KEY_END_TIME);
    }

    public static void saveDeepSleep(String paramString) {
        saveString(KEY_DEEP_SLEEP, paramString);
    }

    public static void saveLightSleep(String paramString) {
        saveString(KEY_LIGHT_SLEEP, paramString);
    }

    public static void saveStartTime(String paramString) {
        saveString(KEY_START_TIME, paramString);
    }

    public static void saveEndTime(String paramString) {
        saveString(KEY_END_TIME, paramString);
    }

    public static void saveBraceletAddress(String paramString) {
        saveString(KEY_BRACELETADDRESS, paramString);
    }

    public static void saveChildrenName(String paramString) {
        saveString(KEY_CHILDRENNAME, paramString);
    }

    public static void saveClassId(String paramString) {
        saveString(KEY_CLASSID, paramString);
    }

    public static void saveClassName(String paramString) {
        saveString(KEY_CLASSNAME, paramString);
    }

    public static void saveHeadImg(String paramString) {
        saveString(KEY_HEADIMG, paramString);
    }

    public static void saveIsFirst(String paramString) {
        saveString(KEY_IS_FIRST, paramString);
    }

    public static void saveKeepLogin(String paramString) {
        saveString(KEY_KEEP_LOGIN, paramString);
    }

    public static void saveNickName(String paramString) {
        saveString(KEY_NICKNAME, paramString);
    }

    public static void saveSObject(String paramString) {
        saveString(KEY_SOBJECT, paramString);
    }

    public static void saveSchoolName(String paramString) {
        saveString(KEY_SCHOOLNAME, paramString);
    }


    public static void saveUserAccount(String paramString) {
        saveString(KEY_USER_ACCOUNT, paramString);
    }

    public static void saveUserId(String paramString) {
        saveString(KEY_USERID, paramString);
    }

    public static void saveUserPwd(String paramString) {
        saveString(KEY_USER_PWD, paramString);
    }

    public static void saveRole(String paramString) {
        saveString(KEY_ROLE, paramString);
    }

    public static String getVersion() {
        return getString(KEY_VERSION);
    }

    public static String getVersionDescription() {
        return getString(KEY_VERSION_DSP);
    }

    public static String getVersionUrl() {
        return getString(KEY_VERSION_URL);
    }

    public static void saveVersion(String paramString) {
        saveString(KEY_VERSION, paramString);
    }

    public static void saveVersionDescrtption(String paramString) {
        saveString(KEY_VERSION_DSP, paramString);
    }

    public static void saveVersionUrl(String paramString) {
        saveString(KEY_VERSION_URL, paramString);
    }


    static SharedPreferences getSharedPreferences() {
        return GbbCache.getContext().getSharedPreferences("Sample", 0);
    }

    private static String getString(String paramString) {
        return getSharedPreferences().getString(paramString, null);
    }

    private static void saveString(String paramString1, String paramString2) {
        SharedPreferences.Editor localEditor = getSharedPreferences().edit();
        localEditor.putString(paramString1, paramString2);
        localEditor.commit();
    }
}
